<template>
  <u-input v-model="value" :disabled="disabled" :maxlength="maxlength" :border="false" :placeholder="placeholder" type="textarea"
    :input-align="inputAlign" />
</template>

<script>
export default {
  name: "yer-input",
  props: {
    disabled: Boolean,
    defaultValue: "", //默认显示的字典，传字典的代码项
    inputAlign: {
      type: String,
      default: "left",
    }, //input内容对齐方式三种：left  center  right  默认left
    placeholder: {
      type: String,
      default: "请选择",
    },
    maxlength:{
      type: [String,Number],
      default:200
    }
  },
  emits: ["update:modelValue", "input"],
  data() {
    return {
      value: "", //字典展示的值，对应的是字典名称
    }
  },
  methods: {
    clear() {
      this.value = "";
    },

  },
  watch: {
    value: function (newVal, oldVal) {
      this.$emit("update:modelValue", newVal);
      this.$emit("input", newVal);
    },
    defaultValue: {
      immediate: true,
      handler: function (newVal, oldVal) {
        if (newVal == 0) {
          this.value = newVal + "";
        } else {
          this.value = newVal;
        }
      },
    }
  },
};
</script>

<style>

</style>
